import pageOpt from '../base/pageViewOptimize'
import { UI_Listen } from '../../config/ui_def'
cc.Class({
    extends: pageOpt,

    properties: {

    },

    // LIFE-CYCLE CALLBACKS:

    // update (dt) {},
    // itemInit(index, info) {
    //     let item = this.content.children[index]
    //     // item.getChildByName('lab').getComponent(cc.Label).string = `${info.index}`//测试用
    // },

    grpInit(grp, index, equipIndex) {
        this.init(index)
        this.equipIndex = equipIndex
        this.pageInit(this.pageItemInit, grp, this.touchStart)
    },
    /**
     * @param {*} index pageview的index参数
     * @param {*} info 传入信息
     */
    pageItemInit(index, info) {
        let page = this.content.children[index]
        if (index == 1) {
            // console.log(info)
            if(parseInt(info)!=1005){
                he.voice.playEffect(`${info}`, 'voice')
            }
            page.getComponent('equipPageItem').init(info, this.equipIndex)
            let rolegrp = he.local.getJson('team', 'user')
            gg.eventManager.emit('equip', { type: UI_Listen.EQUIP_PAGE, info: info })

        } else {
            page.getComponent('equipPageItem').init(info)
        }
    },

    closeListen() {
        this.closeTouchListen()
    },


    touchStart(index) {
        let page = this.content.children[index]
        page.getComponent('equipPageItem').touchStartServer()

    },


});
